﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HikVisionTool.Helper
{
    public class Sql10Helper
    {
        private ConnectionConfig connection = null;
        public SqlSugarClient db = null;
        public Sql10Helper()
        {
            string SqlIP = "10.106.26.10";
            string database = "MESDB";
            string uid = "hkws";
            string pwd = "8ik,9ol.";
            connection = new ConnectionConfig()
            {
                ConnectionString = "server='" + SqlIP + "';initial catalog='" + database + "';uid='" + uid + "';pwd='" + pwd + "'",
                DbType = DbType.SqlServer,
                IsAutoCloseConnection = true,
                InitKeyType = InitKeyType.Attribute
            };
            db = new SqlSugarClient(connection);
        }
        public bool SqlCheck()
        {
            try
            {
                db.Open();
                db.Close();
                db.Dispose();
                return true;
            }
            catch (Exception ee)
            {
                return false;
            }
        }



        #region hkws
        [SugarTable("hkws")]
        public class hkws
        {
            public int id_wo { get; set; }
            public string plcode { get; set; }
            public int Jiwei { get; set; }
            public string Gongwei { get; set; }
            [SugarColumn(IsPrimaryKey = true)]
            public string prodBarCode { get; set; }
            public DateTime createTime { get; set; }
        }
        #endregion

    }
}
